﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Wimm.Common.Interfaces.Utils;

namespace Wimm.Common.Entities.Utils
{
    public class GenericPagedResult<T> : IPagedResult<T>
    {
        public GenericPagedResult(int pageNumber, int pageSize, int totalSize, IEnumerable<T> data)
        {
            this.PageNumber = pageNumber;
            this.PageSize = pageSize;
            this.TotalPages = totalSize;
            this.Data = new ObservableCollection<T>();
            
            if (data != null)
            {
                foreach (T d in data)
                    this.Data.Add(d);
            }
        }

        public int PageNumber { get; protected set; }

        public int PageSize { get; protected set; }

        public int TotalPages { get; protected set; }

        public ObservableCollection<T> Data { get; protected set; }
    }
}
